<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex align-stretch benben-position-layout flex searchResult_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex align-center justify-between flex-sub searchResult_fd0_0'>
          <view class='flex align-center justify-center searchResult_fd0_0_c0' @tap.stop="handleJumpDiy"
            data-type="back" data-url="1">
            <text class='fu-iconfont2  searchResult_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex align-center flex-sub searchResult_fd0_0_c1'>
            <image class='searchResult_fd0_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"42.png"'></image>
            <benben-input class='flex-sub searchResult_fd0_0_c1_c1' type="text" :placeholder="`搜索`" confirm-type="done"
              :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:24rpx" @confirm="getPstFunc()"
              v-model="keyworld" />
            <image class='searchResult_fd0_0_c1_c2' mode="aspectFit" :src='STATIC_URL+"48.png"'
              @tap.stop="clearSearchFunc()"></image>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout searchResult_flex_1">
        <template v-for='(item,key0) in postList'>
          <view class='flex flex-direction flex-wrap align-stretch searchResult_fd1_0' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pages/shouye/postquestionsDetails/postquestionsDetails?id=${item.aid}`"
            :key='key0'>
            <view class='flex flex-wrap align-center'>
              <text class='searchResult_fd1_0_c0_c0'>{{item.title}}</text>
            </view>
            <view class='flex flex-wrap align-center searchResult_fd1_0_c1'>
              <text class='searchResult_fd1_0_c1_c0'>{{item.content}}</text>
            </view>
            <view class='flex flex-wrap align-center searchResult_fd1_0_c2'>
              <image class='searchResult_fd1_0_c2_c0' mode="aspectFill" :src='item.avatar'></image>
              <text class='searchResult_fd1_0_c2_c1'>{{item.user_nickname}}</text>
              <text class='searchResult_fd1_0_c2_c2'>{{item.create_time}}</text>
              <text class='searchResult_fd1_0_c2_c3'>{{item.type_name}}</text>
            </view>
            <view class='flex flex-wrap align-center justify-between searchResult_fd1_0_c3'>
              <view class='flex flex-wrap align-center'>
                <image class='searchResult_fd1_0_c3_c0_c0' mode="aspectFit" :src='STATIC_URL+"65.png"'
                  v-if=" item.is_support==0"></image>
                <image class='searchResult_fd1_0_c3_c0_c0' mode="aspectFit" :src='STATIC_URL+"119.png"'
                  v-if=" item.is_support=='1'"></image>
                <text class='searchResult_fd1_0_c2_c3'>{{item.support_number}}</text>
              </view>
              <view class='flex flex-wrap align-center'>
                <image class='searchResult_fd1_0_c3_c0_c0' mode="aspectFit" :src='STATIC_URL+"24.png"'
                  v-if=" item.is_collection==0"></image>
                <image class='searchResult_fd1_0_c3_c0_c0' mode="aspectFit" :src='STATIC_URL+"83.png"'
                  v-if=" item.is_collection=='1'"></image>
                <text class='searchResult_fd1_0_c2_c3'>{{item.collection_number}}</text>
              </view>
              <view class='flex flex-wrap align-center'>
                <image class='searchResult_fd1_0_c3_c0_c0' mode="aspectFit" :src='STATIC_URL+"26.png"'></image>
                <text class='searchResult_fd1_0_c2_c3'>{{item.comment_number}}</text>
              </view>
              <!-- <view class='flex flex-wrap align-center'>
                <image class='searchResult_fd1_0_c3_c0_c0' mode="aspectFit" :src='STATIC_URL+"25.png"'></image>
                <text class='searchResult_fd1_0_c2_c3'>{{item.support_number}}</text>
              </view> -->
            </view>
          </view>
        </template>

      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-center justify-center benben-flex-layout searchResult_flex_2"
        v-if=" postList.length<'1'">
        <image class='searchResult_fd2_0' mode="aspectFit" :src='STATIC_URL+"49.png"'></image>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "postList": [],
        "keyworld": ""
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        keyworld
      } = options
      if (keyworld !== undefined) this.keyworld = keyworld
      this.getPstFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //清除搜索
      clearSearchFunc() {
        this.keyworld = '';
        this.getPstFunc()
      },
      //获取列表
      async getPstFunc() {
        //请求方法
        //数据验证

        let datapostList = await this.$api.get(global.apiUrls.post6576d52e059d0, {
          title: this.keyworld
        });

        if (datapostList.data.code != 1) {
          this.$message.info(datapostList.data.msg);
          return
        }
        let infopostList = datapostList.data.data;
        this.postList = infopostList.data

      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(248, 248, 248, 1);
    background-size: 100% auto;
  }

  .searchResult_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .searchResult_fd0_0_c1_c2 {
    width: 28rpx;
    height: 28rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .searchResult_fd0_0_c1_c1 {
    font-size: 24rpx;
    font-weight: 400;
    color: #333;
  }

  .searchResult_fd0_0_c1_c0 {
    width: 24rpx;
    height: 24rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .searchResult_fd0_0_c1 {
    background: rgba(249, 249, 249, 1);
    height: 64rpx;
    border-radius: 34rpx 34rpx 34rpx 34rpx;
    padding: 0rpx 24rpx 0rpx 24rpx;
    margin: 0rpx 24rpx 0rpx 24rpx;
  }

  .searchResult_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
    line-height: 28rpx;
  }

  .searchResult_fd0_0_c0 {
    width: 50rpx;
    height: 50rpx;
  }

  .searchResult_fd0_0 {
    padding: 0rpx 32rpx 0rpx 24rpx;
    line-height: 88rpx;
  }

  .searchResult_flex_1 {
    padding: 24rpx 32rpx 0rpx 32rpx;
  }

  .searchResult_fd1_0_c3_c0_c0 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 12rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c3 {
    border-top: 1px solid #eee;
    padding: 32rpx 0rpx 0rpx 0rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c2_c3 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .searchResult_fd1_0_c2_c2 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
    margin: 0rpx 17rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c2_c1 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 700;
    line-height: 32rpx;
    margin: 0rpx 20rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c2_c0 {
    width: 48rpx;
    height: 48rpx;
    border-radius: 50%;
    margin: 0rpx 14rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c2 {
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c1_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 44rpx;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .searchResult_fd1_0_c1 {
    margin: 20rpx 0rpx 0rpx 0rpx;
  }

  .searchResult_fd1_0_c0_c0 {
    color: #333333;
    font-size: 32rpx;
    font-weight: 700;
    line-height: 35rpx;
  }

  .searchResult_fd1_0 {
    background: rgba(255, 255, 255, 1);
    border-radius: 16rpx;
    background-size: 100% auto;
    margin: 0rpx 0rpx 24rpx 0rpx;
    padding: 32rpx 24rpx 32rpx 24rpx;
  }

  .searchResult_flex_2 {
    margin: 219rpx 0rpx 0rpx 0rpx;
  }

  .searchResult_fd2_0 {
    width: 440rpx;
    height: 358rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }
</style>
